package com.dynamixsoftware.printershare;

import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Picture;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Telephony.Mms;
import android.provider.Telephony.Sms;
import android.text.TextUtils;
import com.android.mms.model.SlideModel;
import com.android.mms.model.SlideshowModel;
import com.android.mms.model.TextModel;
import com.google.android.mms.MmsException;
import com.google.android.mms.pdu.EncodedStringValue;
import com.google.android.mms.pdu.MultimediaMessagePdu;
import com.google.android.mms.pdu.NotificationInd;
import com.google.android.mms.pdu.PduPersister;
import com.google.android.mms.pdu.RetrieveConf;
import com.google.android.mms.pdu.SendReq;
import java.util.StringTokenizer;
import java.util.Vector;

public class ActivityPrintMessages
  extends ActivityPrintText
{
  private ContactInfoCache cache;
  private String dat;
  
  protected void createPages()
  {
    initPage();
    Vector localVector = new Vector();
    StringTokenizer localStringTokenizer = new StringTokenizer(this.dat, "\n");
    Cursor localCursor;
    Object localObject;
    String str8;
    String str9;
    long l1;
    String str17;
    label350:
    String str11;
    if (localStringTokenizer.hasMoreTokens())
    {
      String str4 = localStringTokenizer.nextToken();
      int i3 = str4.indexOf(" ");
      String str5 = str4.substring(0, i3);
      String str6 = str4.substring(i3 + 1);
      Object[] arrayOfObject2 = new Object[2];
      arrayOfObject2[0] = Integer.valueOf(0);
      arrayOfObject2[1] = str6;
      localVector.add(arrayOfObject2);
      Uri localUri1 = Uri.parse("content://mms-sms/conversations/" + str5);
      localCursor = getContentResolver().query(localUri1, new String[] { "transport_type", "_id", "thread_id", "address", "body", "date", "read", "type", "status", "sub", "sub_cs", "date", "read", "m_type", "msg_box", "d_rpt", "rr", "err_type" }, null, null, null);
      if (localCursor.moveToNext())
      {
        str7 = null;
        localObject = null;
        str8 = null;
        str9 = localCursor.getString(0);
        l1 = localCursor.getLong(1);
        if ("sms".equals(str9))
        {
          ContentUris.withAppendedId(Telephony.Sms.CONTENT_URI, l1);
          int i6 = localCursor.getInt(7);
          str17 = localCursor.getString(3);
          if ((i6 == 5) || (i6 == 4) || (i6 == 2) || (i6 == 6))
          {
            str7 = "Me";
            localObject = localCursor.getString(4);
            long l4 = localCursor.getLong(5);
            String str18 = getString(2131099868);
            Object[] arrayOfObject5 = new Object[1];
            arrayOfObject5[0] = App.formatTimeStampString(this, l4, true);
            str11 = String.format(str18, arrayOfObject5);
          }
        }
      }
    }
    for (;;)
    {
      label404:
      Object[] arrayOfObject3 = new Object[5];
      arrayOfObject3[0] = Integer.valueOf(1);
      arrayOfObject3[1] = str7;
      arrayOfObject3[2] = str11;
      arrayOfObject3[3] = str8;
      arrayOfObject3[4] = localObject;
      localVector.add(arrayOfObject3);
      break;
      str7 = this.cache.getContactName(str17);
      break label350;
      if (!"mms".equals(str9)) {
        break;
      }
      Uri localUri2 = ContentUris.withAppendedId(Telephony.Mms.CONTENT_URI, l1);
      localCursor.getInt(14);
      int i4 = localCursor.getInt(13);
      String str10 = localCursor.getString(9);
      boolean bool1 = TextUtils.isEmpty(str10);
      str8 = null;
      if (!bool1)
      {
        EncodedStringValue localEncodedStringValue1 = new EncodedStringValue(localCursor.getInt(10), PduPersister.getBytes(str10));
        str8 = localEncodedStringValue1.getString();
      }
      PduPersister localPduPersister = PduPersister.getPduPersister(this);
      if (130 == i4) {}
      NotificationInd localNotificationInd;
      label625:
      String str16;
      long l3;
      long l2;
      label658:
      String str13;
      Object[] arrayOfObject4;
      MultimediaMessagePdu localMultimediaMessagePdu;
      SlideshowModel localSlideshowModel;
      RetrieveConf localRetrieveConf;
      EncodedStringValue localEncodedStringValue2;
      String str12;
      label866:
      try
      {
        localNotificationInd = (NotificationInd)localPduPersister.load(localUri2);
        EncodedStringValue localEncodedStringValue3 = localNotificationInd.getFrom();
        localObject = null;
        str7 = null;
        if (localEncodedStringValue3 == null) {
          break label1524;
        }
        String str15 = localEncodedStringValue3.getString();
        str7 = this.cache.getContactName(str15);
        str16 = new String(localNotificationInd.getContentLocation());
      }
      catch (MmsException localMmsException1) {}
      try
      {
        l3 = localNotificationInd.getExpiry();
        l2 = l3 * 1000L;
        localObject = str16;
        str13 = getString(2131099868);
        arrayOfObject4 = new Object[1];
        arrayOfObject4[0] = App.formatTimeStampString(this, l2, true);
        str11 = String.format(str13, arrayOfObject4);
      }
      catch (MmsException localMmsException2)
      {
        for (;;)
        {
          label1338:
          localObject = str16;
        }
      }
    }
    localMultimediaMessagePdu = (MultimediaMessagePdu)localPduPersister.load(localUri2);
    localSlideshowModel = SlideshowModel.createFromPduBody(this, localMultimediaMessagePdu.getBody());
    if (i4 == 132)
    {
      localRetrieveConf = (RetrieveConf)localMultimediaMessagePdu;
      localEncodedStringValue2 = localRetrieveConf.getFrom();
      localObject = null;
      str7 = null;
      if (localEncodedStringValue2 == null) {
        break label1532;
      }
      str12 = localEncodedStringValue2.getString();
    }
    label1524:
    label1532:
    for (String str7 = this.cache.getContactName(str12);; str7 = "Anonymous")
    {
      SlideModel localSlideModel;
      for (l2 = 1000L * localRetrieveConf.getDate();; l2 = 1000L * ((SendReq)localMultimediaMessagePdu).getDate())
      {
        int i5 = localSlideshowModel.size();
        localObject = null;
        if (i5 <= 0) {
          break;
        }
        localSlideModel = localSlideshowModel.get(0);
        localObject = null;
        if (localSlideModel == null) {
          break;
        }
        boolean bool2 = localSlideModel.hasText();
        localObject = null;
        if (!bool2) {
          break;
        }
        if (!localSlideModel.getText().isDrmProtected()) {
          break label866;
        }
        localObject = "* DRM protected text *";
        break;
        str7 = "Me";
      }
      String str14 = localSlideModel.getText().getText();
      localObject = str14;
      break label658;
      localMmsException1.printStackTrace();
      App.reportThrowable(localMmsException1);
      str11 = null;
      break label404;
      localCursor.close();
      break;
      int i = 0;
      int j = localVector.size();
      if (i < j)
      {
        newPage();
        Object[] arrayOfObject1 = (Object[])localVector.elementAt(i);
        Paint localPaint2;
        int i2;
        if (((Integer)arrayOfObject1[0]).intValue() == 0)
        {
          localPaint2 = App.newPaint();
          localPaint2.setStyle(Paint.Style.FILL);
          i2 = testTextSize((String)arrayOfObject1[1], 70, true, 0.0F, 20);
          if (needNew(10, 45 + (i2 + 30))) {
            i--;
          }
        }
        for (;;)
        {
          i++;
          break;
          printRect(-2565928, 0, 0, this.page.getWidth() - 2 * this.m, (int)((i2 + 30) * this.fontSizeCoef));
          localPaint2.setColor(-16777216);
          printText((String)arrayOfObject1[1], 70, true, 0.0F, 20, 70, i2 + 30, localPaint2);
          continue;
          String str1 = (String)arrayOfObject1[1] + ": ";
          String str2 = (String)arrayOfObject1[4] + " ";
          String str3 = (String)arrayOfObject1[3];
          if ((str3 != null) && (str3.length() > 0)) {
            str2 = "<" + str3 + "> " + str2;
          }
          Paint localPaint1 = App.newPaint();
          localPaint1.setStyle(Paint.Style.FILL);
          localPaint1.setTextSize(45.0F);
          int k = testTextSize(str1 + str2, 45, true, 0.0F, 20);
          if (arrayOfObject1[2] != null) {}
          for (int m = testTextSize((String)arrayOfObject1[2], 30, false, 0.0F, 10);; m = 0)
          {
            if ((!needNew(0, m + k)) || (needNew(0, testTextSize(str1 + str2, 45, true, 0.0F, 20)))) {
              break label1338;
            }
            i--;
            break;
          }
          float[] arrayOfFloat = new float[str1.length()];
          localPaint1.getTextWidths(str1, 0, str1.length(), arrayOfFloat);
          float f = 0.0F;
          for (int n = 0;; n++)
          {
            int i1 = arrayOfFloat.length;
            if (n >= i1) {
              break;
            }
            f += arrayOfFloat[n];
          }
          printText(str1, 45, true, 0.0F, 20, 45, 55, localPaint1);
          this.canvas.translate(0.0F, -55.0F * this.fontSizeCoef);
          this.th = ((int)(this.th + -55.0F * this.fontSizeCoef));
          printText(str2, 45, false, f, 20, 45, 55, localPaint1);
          localPaint1.setColor(-8355712);
          if (arrayOfObject1[2] != null) {
            printText((String)arrayOfObject1[2], 30, false, 0.0F, 10, 30, 40, localPaint1);
          }
        }
      }
      addPage();
      return;
      str7 = "Anonymous";
      break label625;
    }
  }
  
  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    this.dat = getIntent().getExtras().getString("data");
    if (this.dat == null)
    {
      setResult(0);
      finish();
    }
    this.cache = new ContactInfoCache(this);
  }
}


/* Location:           C:\Users\Admin\Desktop\Decompiler\JAD\jd-gui-0.3.6.windows\classes_dex2jar.jar
 * Qualified Name:     com.dynamixsoftware.printershare.ActivityPrintMessages
 * JD-Core Version:    0.7.0.1
 */